package com.appkubes.mall.admin.application.risk.controller;

import com.appkubes.mall.admin.application.risk.config.BaiRongTiming;
import com.appkubes.mall.admin.application.risk.entity.MallBaiRongVO;
import com.appkubes.mall.admin.application.risk.service.RiskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author: leeming
 * @Date: 2020-02-04 16:16
 * @Description:
 */
@Slf4j
@Api(tags = "百融接口")
@RestController
@RequestMapping("/risk/")
public class RiskController {
    @Autowired
    RiskService riskService;
    /**
     * 获取token和swit_number访问网页
     * @return
     */
    @ApiOperation("百融访问网页")
    @GetMapping("/StrategyDemo")
    public void StrategyDemo(MallBaiRongVO mallBaiRongVO,
                             HttpServletResponse resp) throws IOException {
        String str = riskService.StrategyDemoAppkey2(mallBaiRongVO);
        mallBaiRongVO.setSwitNumber(str);
        riskService.InsertBaiRong(mallBaiRongVO);
        resp.sendRedirect("https://apiservice.100credit.com/v/#/userReport/"+str+"/"+ BaiRongTiming.st);
    }
}
